import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/Login'
import Register from '@/views/Register'
import Detail from '@/views/Detail'
import Layout from '@/views/Layout'
import HomePage from '@/views/HomePage'
import QuestionPage from '@/views/QuestionPage'
import VideoPage from '@/views/VideoPage'
import UserPage from '@/views/UserPage'

Vue.use(VueRouter)

const routes = [
  { path: '/login', component: Login },
  { path: '/register', component: Register },
  { path: '/detail', component: Detail },
  {
    path: '/',
    component: Layout,
    children: [
      { path: '/homePage', component: HomePage },
      { path: '/questionPage', component: QuestionPage },
      { path: '/videoPage', component: VideoPage },
      { path: '/userPage', component: UserPage }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
